<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>{:config('title.name')}管理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/iconfont/iconfont.css">
    <link rel="stylesheet" href="/iconfont/iconfont_1.css" media="all">
    <link rel="stylesheet" href="__STATIC__/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="__STATIC__/style/admin.css" media="all">
    <link rel="stylesheet" href="/css/default.css" media="all">
    <link rel="stylesheet" href="__LIB__/font-awesome/css/font-awesome.css" media="all">
    <script src="/js/jquery-2.1.3.min.js"></script>
    <script src="__STATIC__/layui/layui.js"></script>
    <script src="/js/base.js"></script>
    <style>
        .layui-form-label{
            width: 120px !important;
        }
        .layui-input-block {
            margin-left: 150px !important;
            min-height: 36px;
        }

        .link-url{
            height: 38px;
            display: block;
            line-height: 38px;
            color: #01AAED;
        }
    </style>
</head>
<body class="layui-layout-body">
    <div id="LAY_app">
        <div class="layui-layout layui-layout-admin">
            <div class="layui-header">
                <!-- 头部区域 -->
                <ul class="layui-nav layui-layout-left">
                    <li class="layui-nav-item layadmin-flexible" lay-unselect>
                        <a href="javascript:;" layadmin-event="flexible" title="侧边伸缩">
                            <i class="layui-icon layui-icon-shrink-right" id="LAY_app_flexible"></i>
                        </a>
                    </li>
                    <li class="layui-nav-item" lay-unselect>
                        <a href="javascript:;" layadmin-event="refresh" title="刷新">
                            <i class="layui-icon layui-icon-refresh-3"></i>
                        </a>
                    </li>
                </ul>
                <ul class="layui-nav layui-layout-right" lay-filter="layadmin-layout-right" style="margin-right: 20px">
                    <li class="layui-nav-item" lay-unselect>
                        <a href="javascript:;">
                            <cite>{$current_user.name|default=''}</cite>
                        </a>
                        <dl class="layui-nav-child">
                            <dd><a href="{:url('admin/site/change_account')}">账号管理</a></dd>
                            <dd><a href="{:url('admin/site/change_password')}">修改密码</a></dd>
                            <hr>
                            <dd style="text-align: center;"><a href="{:url('admin/site/logout')}">退出</a></dd>
                        </dl>
                    </li>
                </ul>
            </div>

            <!-- 侧边菜单 -->
            <div class="layui-side layui-side-menu">
                <div class="layui-side-scroll">
                    <a class="layui-logo" href="{:url('index/index')}">
                        <span>
                             {if(config('title.index_show_type') == 'logo')}
                                <img src="{:config('title.logo')}" style="width: 140px"/>
                             {/if}
                             {if(config('title.index_show_type') == 'name')}
                               {:config('title.name')}
                             {/if}
                             {if(config('title.index_show_type') == 'both')}
                               <img src="{:config('title.logo')}" style="width: 30px;margin-right: 10px"/>{:config('title.name')}
                             {/if}
                        </span>
                    </a>

                    <ul class="layui-nav layui-nav-tree" lay-shrink="all" id="LAY-system-side-menu" lay-filter="layadmin-system-side-menu">
                        {foreach $menu as $k => $v}
                            <li data-name="{$v['id']}" class="layui-nav-item">
                                <a href="{$v['children']?'javascript:;':$v['url']}"  lay-tips="{$v['title']}" lay-direction="2">
                                    <i class="icon iconfont {$v['icon']}"></i>
                                    <cite>{$v['title']}</cite>
                                </a>
                                {if $v['children']}
                                <dl class="layui-nav-child">
                                    {foreach  $v['children'] as $key => $val}
                                        <dd data-name="{$val['id']}">
                                            <a href="{$val['url']}" >{$val['title']}</a>
                                        </dd>
                                    {/foreach}
                                </dl>
                                {/if}
                            </li>
                        {/foreach}
                    </ul>
                </div>
            </div>

            <div class="layui-body" id="LAY_app_body">
                <div class="layadmin-tabsbody-item layui-show">
                    {if $current_menu}
                    <div style="background: #fff;padding: 15px 15px 15px 20px;">
                        <i class="layui-icon layui-icon-console" style="padding-right: 10px">  </i>
                        <span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
                              {foreach $current_menu as $k=>$v}
                                  <a href="javascript:void(0);">{$v['name']}</a>
                                {if count($current_menu)>=$k+1}
                                    <span lay-separator="">/</span>
                                {/if}
                              {/foreach}
                        </span>
                    </div>
                    {/if}

                    <div class="layui-fluid">
                        <div class="layui-card wrap_content" id="main_wrap">
                            {__CONTENT__}
                        </div>
                    </div>

                </div>
            </div>

            <div class="layadmin-body-shade" layadmin-event="shade"></div>
        </div>
    </div>
    <script>
        layui.config({
            base: '__STATIC__/'
        }).extend({
            index: 'lib/index',
        }).use('index');

        display_menu();
        function display_menu() {
            var menu_id = "{$menu_id}";
            var second = "{$second_parent_id}";
            var menu_parent_id = "{$menu_parent_id}";
            if(menu_id !='' && menu_parent_id != ''){
                if(menu_parent_id !=0){
                    $("#LAY-system-side-menu li[data-name ="+menu_parent_id+"]").addClass('layui-nav-itemed').siblings().removeClass('layui-nav-itemed');
                    $("#LAY-system-side-menu dd").removeClass('layui-this');
                    if(second != ''){
                        $("#LAY-system-side-menu dd[data-name = "+second+"]").addClass('layui-this')
                    }else{
                        $("#LAY-system-side-menu dd[data-name = "+menu_id+"]").addClass('layui-this')
                    }
                }else{
                    $("#LAY-system-side-menu li[data-name ="+menu_id+"]").addClass('layui-this').siblings().removeClass('layui-this');
                }
            }

        }

        $('a[data-iframe="iframe"]').click(function () {
            $('#LAY_app_body').empty().append('<iframe id="wrap_iframe" frameborder="0" class="layadmin-iframe" height="600px"></iframe>');
            $('#wrap_iframe').attr('src',$(this).data('href'));
        })
    </script>
</body>
</html>
